/*
 * Copyright 2007-2010 kingbi.
 * Creator: Janins
 */
package com.kingbi.system.roleFunction.service;

import java.util.List;

import com.kingbi.system.roleFunction.dao.RoleFunctionDao;
import com.kingbi.system.roleFunction.dao.RoleFunctionQuery;
import com.kingbi.system.roleFunction.model.RoleFunctionModel;

/**
 * @author mouzb
 * 
 */
public class RoleFunctionServiceImpl implements RoleFunctionService
{

	private RoleFunctionDao roleFunctionDao;
	public void setRoleFunctionDao(RoleFunctionDao thisDao)
    {
        roleFunctionDao = thisDao;
    }

    public void saveRoleFunction(RoleFunctionModel roleFunctionModel)
    {
	    roleFunctionDao.save(roleFunctionModel);

    }
	
	public RoleFunctionModel loadRoleFunction(int roleFunctionID)
    {
        return roleFunctionDao.findById(roleFunctionID);
    }
	public void deleteRoleFunction(int roleFunctionID)
	{
	    roleFunctionDao.delete(roleFunctionDao.findById(roleFunctionID));
	}

	public List<RoleFunctionModel> listRoleFunction(RoleFunctionModel roleFunctionModel,int start, int max)
	{
	    RoleFunctionQuery roleFunctionQuery = new RoleFunctionQuery();
	    roleFunctionQuery.doSearchQuery(roleFunctionModel);
		return roleFunctionDao.findByHQL(roleFunctionQuery.getSearch_query_bud().toString(),roleFunctionQuery.getParams(), start, max);
	}

	public List<RoleFunctionModel> loadVerifyRoleFunction(int page, int max, Object[] sql_params)
	{
		return roleFunctionDao.findCmd("loadVerifyPack", sql_params, page, max);
	}

    public long queryCount(RoleFunctionModel roleFunctionModel)
    {
        RoleFunctionQuery roleFunctionQuery = new RoleFunctionQuery();
        roleFunctionQuery.doSearchQuery(roleFunctionModel);
        return roleFunctionDao.getCountByHQL(roleFunctionQuery.getSearch_count_bud().toString(), roleFunctionQuery.getParams());
    }
	
	
}
